      subroutine modelo2dcamadasX3(X)

      use globais
      implicit none
      

      double precision ::xmin,zmin
      integer :: i,j

      double precision:: X(N)
      double precision :: mapXemC
!velocidade de propagacao no ar = 340m/s
 !velocidade de propagacao na agua = 1450m/s
! massa especifica da agua = 1000



! ! material 1
!       do j=1,int((Nz-Npml+1)/2)
! 	  do i=1,Nx
! 	      c(i,j) = 1500.
! 	  enddo
!       enddo
! 
! ! material 2
!       do j=int((Nz-Npml+1)/2)+1,Nz
! 	  do i=1,Nx
! 	      c(i,j) = 5000.
! 	  enddo
!       enddo
!       
!       cminreal=1500.



! material 1
      do j=1,51
	  do i=1,Nx
	      c(i,j) = mapXemC(X(1),cmin,cmax)
	  enddo
      enddo

! material 2
      do j=52,101
	  do i=1,Nx
	      c(i,j) = mapXemC(X(2),cmin,cmax)
	  enddo
      enddo

! material 3
      do j=102,Nz
	  do i=1,Nx
	      c(i,j) = mapXemC(X(3),cmin,cmax)
	  enddo
      enddo
      
      cminreal=2000.
      write(*,*)'                      camadas --- ',mapXemC(X(1),cmin,cmax),&
                       & mapXemC(X(2),cmin,cmax),mapXemC(X(3),cmin,cmax)







! ! material 1
!       do j=1,int((Nz-Npml+1)/4)
! 	  do i=1,Nx
! 	      c(i,j) = 1500.
! 	  enddo
!       enddo
! 
! ! material 2
!       do j=int((Nz-Npml+1)/4)+1,int(2*(Nz-Npml+1)/4)
! 	  do i=1,Nx
! 	      c(i,j) = 3000.
! 	  enddo
!       enddo
! 
! ! material 3
!       do j=int(2*(Nz-Npml+1)/4)+1,int(3*(Nz-Npml+1)/4)
! 	  do i=1,Nx
! 	      c(i,j) = 4500.
! 	  enddo
!       enddo
! 
! ! material 4
!       do j=int(3*(Nz-Npml+1)/4)+1,Nz
! 	  do i=1,Nx
! 	      c(i,j) = 6000.
! 	  enddo
!       enddo
! 
! 



! densidade uniforme no modelo
      do j=1,Nz
	  do i=1,Nx
	      rho(i,j) = 2000.
	  enddo
      enddo


! buoyancy e bulk modulus no grid
      do i=1,Nx
	  do j=1,Nz
	      b(i,j) = 1.0/rho(i,j)
	      K(i,j) = rho(i,j)*c(i,j)**2	  
	  enddo
      enddo





      end subroutine modelo2dcamadasX3